﻿using Cinema.BL.Interfaces;
using Cinema.BL.Interfaces.Managers;
using Cinema.BL.Managers;
using Cinema.Model.Interfaces;

namespace Cinema.BL
{
    public class ManagerFactory : IManagerFactory
    {
        private readonly IUnitOfWork _unitOfWork;

        public ManagerFactory(IUnitOfWork unitOfWork)
        {
            _unitOfWork = unitOfWork;
        }

        private IMovieManager _movieManager;
        public IMovieManager MovieManager
        {
            get
            {
                if (_movieManager == null)
                {
                    _movieManager = new MovieManager(_unitOfWork);
                }

                return _movieManager;
            }
        }

        private IUserManager _userManager;
        public IUserManager UserManager
        {
            get
            {
                if (_userManager == null)
                {
                    _userManager = new UserManager(_unitOfWork);
                }

                return _userManager;
            }
        }

        private IActorManager _actorManager;
        public IActorManager ActorManager
        {
            get
            {
                if (_actorManager == null)
                {
                    _actorManager = new ActorManager(_unitOfWork);
                }

                return _actorManager;
            }
        }


        public void Dispose()
        {
        }
    }
}
